package org.wazzapps.vibroplugin;
import android.app.Application;
import android.os.Build;
import android.os.VibrationEffect;
import android.os.Vibrator;
import com.unity3d.player.UnityPlayer;
public class VibroPlugin extends Application {
    private static Vibrator vibroObject;
    public static void vibrate(long j) {
        checkVibroObject();
        vibroObject.cancel();
        if (Build.VERSION.SDK_INT >= 26) {
            vibroObject.vibrate(VibrationEffect.createOneShot(j, -1));
        } else {
            vibroObject.vibrate(j);
        }
    }
    public static void cancel() {
        checkVibroObject();
        vibroObject.cancel();
    }
    private static void checkVibroObject() {
        if (vibroObject == null) {
            vibroObject = (Vibrator) UnityPlayer.currentActivity.getSystemService("vibrator");
        }
    }
}